package com.talos.ums.dal.mysql.usercompany;

import com.talos.framework.common.pojo.PageResult;
import com.talos.framework.mybatis.core.mapper.BaseMapperX;
import com.talos.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.talos.ums.controller.admin.usercompany.vo.UmsUserCompanyPageReqVO;
import com.talos.ums.dal.dataobject.usercompany.UmsUserCompanyDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 用户货主关系表 Mapper
 *
 * @author ${table.author}
 */
@Mapper
public interface UmsUserCompanyMapper extends BaseMapperX<UmsUserCompanyDO> {

    default PageResult<UmsUserCompanyDO> selectPage(UmsUserCompanyPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<UmsUserCompanyDO>()
                .eqIfPresent(UmsUserCompanyDO::getUserId, reqVO.getUserId())
                .eqIfPresent(UmsUserCompanyDO::getCompanyId, reqVO.getCompanyId())
                .eqIfPresent(UmsUserCompanyDO::getTenantId, reqVO.getTenantId())
                .orderByDesc(UmsUserCompanyDO::getId));
    }

}
